(function () {
    function WarnPrint(data) {

//        LODOP.PRINT_INIT(data.headDetail.fbillno);
console.log("=================sadf"+data.boxsCount.length);
        if(data.boxsCount.length>1){
            LODOP.PRINT_INIT();
            for(var i=0;i<data.boxsCount.length;i++){
                LODOP.ADD_PRINT_TEXT(30,10,71,20,"发货单号");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(30,80,115,20,data.headDetail.fbillno);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(6,197,213,35,data.headDetail.FCity);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,15,45,40,"收货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,64,298,40,data.headDetail.FReceive);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,15,45,40,"收货\r\n地址");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,62,300,40,data.headDetail.faddress);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,15,59,20,"联系人");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,79,163,20,data.headDetail.FContacts);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,15,46,19,"电话");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,75,280,20,data.headDetail.FMobile+"   "+data.headDetail.FTel);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(166,15,69,20,data.boxsCount[i]+"号箱");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(167,87,189,20,"冷藏物品请尽快派送");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(186,15,280,20,"日期");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,79,289,20,data.headDetail.FDate);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(206,15,50,35,"发货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(214,73,278,20,"郑州安图生物工程股份有限公司");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                for(var j=0;j<data.bodyList.length;j++){
                   var body = data.bodyList[j];
                   LODOP.ADD_PRINT_TEXT(245+40*j,15,373,20,body.FEntryName);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,15,160,20,body.FEntryModel);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,175,105,20,body.FBatchNo);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,279,56,20,(body.FDoneNumber/data.boxsCount.length).toFixed(2));
                   LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,335,76,20,body.FUnitName);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
              }
              LODOP.NewPage();
            }

             LODOP.PREVIEW();
        }else{
        LODOP.PRINT_INIT(data.headDetail.fbillno);

                LODOP.ADD_PRINT_IMAGE(10,20,70,50,"<img border='0' src='http://192.168.1.9:8086/photo/log.jpg' width='380' heigh='80'/>");
                LODOP.SET_PRINT_STYLEA(0,"Stretch",1)
                LODOP.ADD_PRINT_TEXT(50,120,71,20,"发货单号");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(50,190,115,20,data.headDetail.fbillno);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);

                LODOP.ADD_PRINT_TEXT(6,100,130,35,data.boxsCount[0]+"号箱");
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);

                LODOP.ADD_PRINT_TEXT(6,220,160,35,data.headDetail.FCity);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(69,15,45,40,"收货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(69,64,298,40,data.headDetail.FReceive);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(108,15,45,40,"收货\r\n地址");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(108,62,300,40,data.headDetail.faddress);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,15,59,20,"联系人");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,79,163,20,data.headDetail.FContacts);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(167,15,46,19,"电话");
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(167,75,280,20,data.headDetail.FMobile+"   "+data.headDetail.FTel);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,200,160,20,"冷藏物品请尽快派送");
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,15,280,20,"日期");
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,79,289,20,data.headDetail.FDate);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(206,15,300,45,"郑州安图生物工程股份有限公司\r\n郑州经济技术开发区经开第十五大街199号\r\nTEL:0371-67985875  67985876");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.ADD_PRINT_TEXT(256,15,360,30,"产品名称、包装规格、生产日期、产品批号、失效日\r\n期、储存条件、注册文号等详情见试剂盒包装");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                LODOP.ADD_PRINT_IMAGE(290,40,310,80,"<img border='0' src='http://192.168.1.9:8086/photo/notic.jpg' width='380' heigh='80'/>");
                LODOP.SET_PRINT_STYLEA(0,"Stretch",1)
                console.log(data.bodyList.length);
                var count = data.bodyList.length;
                if(count <3){
                     for(var i=0;i<data.bodyList.length;i++){
                           var body = data.bodyList[i];
                           LODOP.ADD_PRINT_TEXT(372+48*i,15,373,30,body.FEntryName);
                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                           LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                           LODOP.ADD_PRINT_TEXT(400+48*i,15,160,15,body.FEntryModel);
                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                           LODOP.ADD_PRINT_TEXT(400+48*i,175,105,15,body.FBatchNo);
                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                           LODOP.ADD_PRINT_TEXT(400+48*i,279,56,15,body.FDoneNumber);
                           LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                           LODOP.ADD_PRINT_TEXT(400+48*i,335,76,15,body.FUnitName);
                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                     }
                }else{
                     for(var a=0;a<3;a++){
                        var body = data.bodyList[a];
                        LODOP.ADD_PRINT_TEXT(372+48*a,15,373,30,body.FEntryName);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                        LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                       LODOP.ADD_PRINT_TEXT(400+48*a,15,160,15,body.FEntryModel);
                       LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                       LODOP.ADD_PRINT_TEXT(400+48*a,175,105,15,body.FBatchNo);
                       LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                       LODOP.ADD_PRINT_TEXT(400+48*a,279,56,15,body.FDoneNumber);
                       LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                       LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                       LODOP.ADD_PRINT_TEXT(400+48*a,335,76,15,body.FUnitName);
                       LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                      }
                      var pages = count-3;
                      var totalPages = 1;
                      if((pages % 10) == 0) {
                          totalPages = parseInt(pages / 10);
                      }else{
                          totalPages = parseInt(pages / 10) + 1;
                      }
              for(var j=0;j<totalPages;j++){
                LODOP.NewPage();
                if(j==totalPages-1){
                 LODOP.ADD_PRINT_TEXT(8,200,100,30,data.boxsCount[0]+"号箱");
                 LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                 LODOP.SET_PRINT_STYLEA(0,"FontSize",15);
                 LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                 LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                    var end = count - (totalPages-1)*10-3;
                    for(var k=0;k<end;k++){
                        var body1 = data.bodyList[3+k+j*10];
                        LODOP.ADD_PRINT_TEXT(40+48*k,15,373,30,body1.FEntryName);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                        LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                        LODOP.ADD_PRINT_TEXT(67+48*k,15,160,15,body1.FEntryModel);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                        LODOP.ADD_PRINT_TEXT(67+48*k,175,105,15,body1.FBatchNo);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                        LODOP.ADD_PRINT_TEXT(67+48*k,279,56,15,body1.FDoneNumber);
                        LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                        LODOP.ADD_PRINT_TEXT(67+48*k,335,76,15,body1.FUnitName);
                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                    }
                 }else{
                        LODOP.ADD_PRINT_TEXT(8,200,100,30,data.boxsCount[0]+"号箱");
                             LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                             LODOP.SET_PRINT_STYLEA(0,"FontSize",15);
                             LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                             LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                            for(var k=0;k<10;k++){
                                var body1 = data.bodyList[3+k+j*10];
                                LODOP.ADD_PRINT_TEXT(40+48*k,15,373,30,body1.FEntryName);
                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                                LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3);
                                LODOP.ADD_PRINT_TEXT(67+48*k,15,160,15,body1.FEntryModel);
                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                                LODOP.ADD_PRINT_TEXT(67+48*k,175,105,15,body1.FBatchNo);
                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                                LODOP.ADD_PRINT_TEXT(67+48*k,279,56,15,body1.FDoneNumber);
                                LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                                LODOP.ADD_PRINT_TEXT(67+48*k,335,76,15,body1.FUnitName);
                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                            }
                 }
               }
           }
          var enddf = LODOP.PRINT();
//          LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
//          var enddf = LODOP.PREVIEW("_blank",350,560);
          window.MyBrowserAPI.get(enddf);

        }
    }
    window.WarnPrint = WarnPrint;
})();
